package com.gopay.common.gateway.dao.impl;

import com.gopay.common.base.dao.impl.BaseDAOImpl;
import com.gopay.common.domain.fund.FundGopayBankcardInfoEntity;
import com.gopay.common.domain.fund.FundGopayGenOrderTransDtl;
import com.gopay.common.gateway.dao.PgFundCardInfoQueryDao;
import com.gopay.common.gateway.dao.PgFundOrderTransDtlQueryDAO;
import org.springframework.stereotype.Repository;

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author baiyunpeng
 * @2016年7月14日 下午3:36:05  www.gopay.com.cn Inc.All rights reserved.
 */
@Repository("pgFundCardInfoQueryDao")
public class PgFundCardInfoQueryDaoImpl extends BaseDAOImpl<FundGopayBankcardInfoEntity, Serializable> implements
        PgFundCardInfoQueryDao {
    @Override
    public List getList(String today,String yesterday) {
        StringBuffer sql = new StringBuffer("from FundGopayBankcardInfoEntity where  lastUpdTs>TO_DATE(:yesterday,'yyyymmddHH24miss') and lastUpdTs<=TO_DATE(:today,'yyyymmddHH24miss')");
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("yesterday",yesterday);
        map.put("today",today);

        List<FundGopayBankcardInfoEntity> byHql = findByHql(sql.toString(),map);
        if (byHql.size() > 0) {
            return byHql;
        }
        return null;
    }
    @Override
    public List getList(String today, String yesterday, String merId) {
        StringBuffer sql = new StringBuffer("from FundGopayBankcardInfoEntity where merchantId=:merchantId and lastUpdTs>TO_DATE(:yesterday,'yyyymmddHH24miss') and lastUpdTs<=TO_DATE(:today,'yyyymmddHH24miss')");
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("yesterday",yesterday);
        map.put("today",today);
        map.put("merchantId",merId);
        List<FundGopayBankcardInfoEntity> byHql = findByHql(sql.toString(),map);
        if (byHql.size() > 0) {
            return byHql;
        }
        return null;
    }

}

